home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 3
/
Gekikoh Dennoh Club Vol. 3 (Japan).7z
/
Gekikoh Dennoh Club Vol. 3 (Japan) (Track 1).bin
/
games
/
rifler
/
c
/
src.lzh
/
Rifler.c
< prev
next >
Wrap
Text File
|
1998-01-04
|
6KB
|
285 lines
/*
Rifle the ancient remains
「古跡盗掘」
Rifler.c main routine
Rifler.h header file.
Rifler_v.c v_sync,sp,score,load_map,joystick etc.
Rifler_s.c various routines(load area,change map data,etc.)
Rifler_m.c monster & effector etc.
Rifler_p.c player's & shot's movements & use item.
Rifler_o.c check a overlap & calc. hp,sc,hs etc.
Rifler_d.c domonstration etc.
BY SJOM
*/
#include <unistd.h>
#define first
#include "Rifler.h"
char no_option_msg[]=
"Rifle the ancient remains
「古跡盗掘」 version.1.04
BY SJOM
実行方法
filer.x filename.???
filenameは、面データの入ったファイルで、拡張子は、
何でもいいです。";
#define gameover 1
#define ending 0
static void
main_abort(void)
{
_iocs_vdispst(0,0,1);
_iocs_crtcras(0,0);
/* _iocs_hsyncst(0); */
}
static void
initialize(void)
{
contrast(0); /* set constrast to 0 */
wait_time(100); /* one second wait */
_iocs_crtmod(14); /* set crt mode to 31kHz 256*256 */
_iocs_g_clr_on(); /* initialize graphic vram */
_iocs_sp_init(); /* initialize sprite */
_iocs_bgctrlst(0,1,1); /* bg0 - bgtext1 */
_iocs_bgtextcl(1,0); /* clear bg0(bgtext1) */
_iocs_b_clr_al(); /* clear text vram */
init_sounds(); /* check zmusic & load se & bgm */
if (zmusic==0) {
puts("無音モードになります。");
wait_time(800);
_iocs_b_clr_al();
};
PAL_load("Rifler.PAL"); /* load sprite palette data */
PCG_load("Rifler_s.SP"); /* load basic sprite PCG data */
player_PCG_load("Rifler_p.SP"); /* allocate player's sprite PCG data */
gbg_PCG_load("Rifler.GBG"); /* allocate gbg data */
_iocs_b_curoff(); /* cursol off */
init_sp_data();
_iocs_sp_on();
now_map=malloc_check(32*32);
}
static void
put_logotype(void)
{
contrast(0);
wait_time(200);
contrast(15);
/* print_bg(12,16,sjom_msg);*/
print_sjom_logo();
wait_time(300); /* 3 seconds wait */
contrast(0);
wait_time(200);
print_bg(12,16,BG_clr_16);
}
static void
demo(void)
{
while (true)
if (title()==yes) {
demo_gbg_set();
if (demo_play()) {
contrast(0);
wait_time(200);
break;
};
} else
break;
}
static void
game_clear_loop(void)
{
int loop;
bgm(game_clear_bgm);
for (loop=0;loop<60*3;loop++) {
switch (loop & 3) {
case 0:
game_player.dir=down;
break;
case 1:
game_player.dir=right;
break;
case 2:
game_player.dir=up;
break;
default:
game_player.dir=left;
};
player_sp_set(&game_player,character);
sort_out_sprite();
sprite_sw=on;
wait_vsync();
score_calc();
hp_calc();
wait_vsync();
score_calc();
hp_calc();
escape();
if (loop==60*2)
contrast(0);
};
for (;;) {
score_calc();
hp_calc();
if ((addsub_sc==0) & (addsub_hp==0))
break;
};
}
int
game_main(void)
{
int loop;
area_no=0;
now_area_data=area_data;
print_bg(0,0,hp_sc_hs);
print_bg(0,31,item_msg);
game_player.hp=4;
addsub_hp=affinity[character].first_hp*4-4;
score=addsub_sc=mattock=elixir=large_shield=small_shield=0;
print_number(hi_sc_x,hi_sc_y,hi_score,100000);
for (;;) {
init_sp_data();
gold_no=now_area_data->gold_no;
wflash_sw=off;
flash.x=flash.y=0;
/*
if (gold_no==not_ready) {
map_convert(now_area_data);
gold_no=now_area_data->gold_no;
};
*/
get_true_key=no;
game_clear=no;
game_start_time=_iocs_ontime();
game_limit_time=game_start_time+120*100+gold_no*10*100;
if (game_limit_time>8639999)
game_limit_time-=8640000;
print_bg(key_x,item_y," ");
print_map(); /* init. anything & display */
scroll_sw=on;
bgm(game_bgm);
contrast(15);
for (loop=0;loop<6*5;loop++) { /* it equals wait_time(50); */
wait_vsync();
};
for (;;) {
move_player(); /* a movement of player */
use_mattock(); /* use mattock */
#ifdef debug
if (_iocs_bitsns(5) & 4) { /*key z 押されたか?*/
character++;
if (character<0)
character=4;
if (character>=5)
character=0;
wait_time(40);
wait_vsync();
exchange_player_PCG(character);
};
#endif
move_shot(); /* a movement of shot */
move_monster(); /* a movement of monsters */
move_effector(); /* a movement of effectors */
take_item(); /* take items */
overlap_characters(); /* check a overlap */
way_flash();
score_calc();
hp_calc();
sort_out_sprite();
if (scroll_mode)
scroll_sw=on;
else
sprite_sw=on;
wait_vsync();
if (game_clear)
break;
if (game_player.hp==0) {
/*game_clear=no;*/
break;
};
escape();
pause_space();
time_limit_check();
};
if (game_clear) /* game clear */
game_clear_loop();
else {
/* game_over sub */
prt_game_over();
return gameover;
};
now_area_data=now_area_data->next;
if (now_area_data==NULL) {
init_sp_data();
endings();
return ending;
};
area_no++;
};
}
#define first_hisc 6800
int
main(int argc,char **argv)
{
/*debug_mode=off;*/
if (argc!=2) {
puts(no_option_msg);
exit(noerror);
};
/*
if (argc<2) {
puts(no_option_msg);
exit(noerror);
} else if (argc>=3)
*//*debug_mode=on;*//*
ligten_a_load=true;
*/
onexit((onexit_t)main_abort);
_iocs_vdispst(&vsync_routine,0,1); /* v_blank rewriting on */
load_area(argv[1]);
initialize();
hi_score=first_hisc;
put_logotype();
for (;;) {
scroll_x=scroll_y=0;
scroll_sw=on;
wait_vsync();
demo();
character=select_player();
if (game_main()==ending)
put_logotype();
};
}